package PTA;

import java.util.Scanner;
class Vehicle {
    int length;
    String plateNo;
    public Vehicle(int length, String plateNo) {
        this.length = length;
        this.plateNo = plateNo;
    }
    public Vehicle(int length) {
        this.length = length;
    }

    public String getString() {
        return "车牌号："+plateNo+"\n"
                +"车长："+length+"\n";
    }
    public double getRate() {
        return 0;
    }
}
class Bus extends Vehicle{
    int passengers;
    public Bus(int length, String plateNo, int passengers) {
        super(length, plateNo);
        this.passengers = passengers;
    }
    @Override
    public String getString() {
        return super.getString()+"核定载人数："+passengers;
    }

    @Override
    public double getRate() {
        if(length < 6000) {
            return 0.6;
        }
        else {
            return 0.9;
        }
    }
}
class Truck extends Vehicle {
    double weight;
    int numbersOfAxles;
    public Truck(int length, String plateNo, double weight, int numbersOfAxles) {
        super(length, plateNo);
        this.weight = weight;
        this.numbersOfAxles = numbersOfAxles;
    }
    @Override
    public String getString() {
        return super.getString()+"最大允许总重量："+weight
                +"\n"+"车轴数:"+numbersOfAxles;
    }
    @Override
    public double getRate() {
        if(numbersOfAxles == 2) {
            if(length < 6000 && weight < 4500)
                return 0.6;
            else
                return 0.9;
        }
        if (numbersOfAxles == 3)
            return 1.02;
        if(numbersOfAxles == 4)
            return  1.315;
        if(numbersOfAxles == 5 || numbersOfAxles == 6)
            return 1.428;
        else
            return -1;
    }
}

public class t14 {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner input=new Scanner(System.in);
        double distance=170;//设定该高速公路长度
        int flag=input.nextInt();
        if(flag==1)
        {
            Bus bus=new Bus(input.nextInt(),input.next(),input.nextInt());
            System.out.println("***客车信息***");
            System.out.println(bus.getString());
            double fees=distance*bus.getRate();
            System.out.println("您的车辆需缴费"+fees+"元！");
        }
        else if(flag==2)
        {
            Truck truck=new Truck(input.nextInt(),input.next(),input.nextDouble(),input.nextInt());
            System.out.println("***货车信息***");
            System.out.println("货车："+truck.getString());
            double fees=distance*truck.getRate();
            System.out.println("您的车辆需缴费"+fees+"元！");
        }
        else
            System.out.println("已退出收费系统！");
        input.close();
    }

}